package blog.spring.db.entity;

// Generated 2015-1-30 0:04:13 by Hibernate Tools 4.0.0

import java.util.Date;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 * Message generated by hbm2java
 */
@Entity
@Table(name = "message", catalog = "blog")
public class Message implements java.io.Serializable {

	private Integer messageId;
	private Type type;
	private String content;
	private Date createDate;
	private String headUrl;
	private String headPath;
	private boolean isAudit;
	private String nickName;
	private String title;
	private String email;
	private Set<Comment> comments = new HashSet<Comment>(0);

	public Message() {
	}

	public Message(boolean isAudit) {
		this.isAudit = isAudit;
	}

	public Message(Type type, String content, Date createDate, String headUrl,
			String headPath, boolean isAudit, String nickName, String title,
			String email, Set<Comment> comments) {
		this.type = type;
		this.content = content;
		this.createDate = createDate;
		this.headUrl = headUrl;
		this.headPath = headPath;
		this.isAudit = isAudit;
		this.nickName = nickName;
		this.title = title;
		this.email = email;
		this.comments = comments;
	}

	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "message_id", unique = true, nullable = false)
	public Integer getMessageId() {
		return this.messageId;
	}

	public void setMessageId(Integer messageId) {
		this.messageId = messageId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "type_id")
	public Type getType() {
		return this.type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	@Column(name = "content", length = 65535)
	public String getContent() {
		return this.content;
	}

	public void setContent(String content) {
		this.content = content;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_date", length = 19)
	public Date getCreateDate() {
		return this.createDate;
	}

	public void setCreateDate(Date createDate) {
		this.createDate = createDate;
	}

	@Column(name = "head_url")
	public String getHeadUrl() {
		return this.headUrl;
	}

	public void setHeadUrl(String headUrl) {
		this.headUrl = headUrl;
	}

	@Column(name = "head_path")
	public String getHeadPath() {
		return this.headPath;
	}

	public void setHeadPath(String headPath) {
		this.headPath = headPath;
	}

	@Column(name = "is_audit", nullable = false)
	public boolean isIsAudit() {
		return this.isAudit;
	}

	public void setIsAudit(boolean isAudit) {
		this.isAudit = isAudit;
	}

	@Column(name = "nick_name")
	public String getNickName() {
		return this.nickName;
	}

	public void setNickName(String nickName) {
		this.nickName = nickName;
	}

	@Column(name = "title")
	public String getTitle() {
		return this.title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	@Column(name = "email")
	public String getEmail() {
		return this.email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	@OneToMany(fetch = FetchType.LAZY, mappedBy = "message")
	public Set<Comment> getComments() {
		return this.comments;
	}

	public void setComments(Set<Comment> comments) {
		this.comments = comments;
	}

}
